BlockArray

annotation class BlockArray(val itemsPerLine: Int = 1)

Java-field-friendly version of TomlBlockArray

Modifies the encoding process of corresponding array-like property, either to force array of table to be encoded as block array, or to change how many items should be encoded per line (this will override the default config).

Note that, if the annotated property is also marked with Inline, this annotation will not take effect.

class NullablePairList<F, S>(
@TomlBlockArray(2)
val list: List<Pair<F, S>?>
)
NullablePairList(listOf(Pair("key", 1), null, Pair("key", 3), Pair("key", 4)))

will produce:

list = [
{ first = "key", second = 1 }, null,
{ first = "key", second = 3 }, { first = "key", second = 4 }
]

Author

fzzyhmstrs

Since

0.2.0

Properties

Link copied to clipboard
val itemsPerLine: Int = 1